import { http} from '@/api'

const state = {
  deptList: [],
    meetingTypeList: []
}

const mutations = {
  SET_DEPT(state, val) {
    state.deptList = val
  },
    SET_MEETINGTYPE(state, val) {
        state.meetingTypeList = val
    },
}
const actions = {
  getDict({ commit }, codes) {
    return new Promise(async (resolve, reject) => {
     const deptRes = await http.dept.list()
        commit('SET_DEPT', deptRes.data.map(el => {
            return {
                value: el.id,
                name: el.departName
            }
        }))
      const meetingTypeRes = await http.getMeetingType()
        commit('SET_MEETINGTYPE', meetingTypeRes.data)
            resolve()
    })
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
